7-segment Display
__TOC__ Multiplexed 7-Segment Display PCB The display PCB consists of four MAN72 7-segment common-anode displays, a GAL16V8 PLD and various current limiting resistors. The GAL16V8 controls which segments are active based on the 4-bit input it receives. This means that it can display any decimal number from zero to sixteen in hexadecimal on the 7-segment display. Below is the PLD table showing how the output bits related to the received input. A one indicates a high and a zero is a low. Because the 7-segment displays are common-anode, when it receives a high output it will turn the LED segment off, and a low output will turn the LED segment on. MAN72 7-Segment Display A 7-segment display is a component which is essentially made of 7 separate LEDs arranged so that they can display a digit. The MAN72 7-segment displays that are being used are common-anode, meaning that all of the anodes for the seven LEDs are connected together. Given a current to the common anode, each individual segment will only be lit when its cathode (negative lead) is pulled low. This is what the GAL16V8 PLD controls and this is why the outputs of the PLD are connected to the cathodes for each LED segment. For this project, the decimal point segments are not being used. GAL16V8 PLD The GAL16V8 is a programmable logic device (PLD) which controls which LED segment becomes lit given an input. For this project, is is programmed to accept a 4-bit input and output 7-bits to the 7-segment displays. Below is the PLD table showing how the output bits related to the received input. A one indicates a high and a zero is a low. Because the 7-segment displays are common-anode, when it receives a high output it will turn the LED segment off, and a low output will turn the LED segment on. Circuit Design The prototype circuit diagram for a single 7-segment display connected to the PLD is shown below, with the inputs controlled by a DIP switch: In order to have four 7-segment displays connected to a single PLD, multiplexing must be used so that at any single point in time only one display is active. For this, the anodes to each display must be interfaced with the microcontroller (PA0, PA3, PA5, PA7) to allow multiplexing of the four display components. By cycling between the four displays rapidly, a four digit number can be displayed at once. The inputs to the PLD are also given by the microcontroller (PB0 - PB3). The 5-pin header is for interfacing with the sensor box. Each separate cathode for the four displays are connected to one another, since only one display will be active at any single time. The full circuit diagram with all four 7-segment displays connected to the PLD and the microcontroller interface (MCU port): MCU interface port The MCU port is how the sensor box and the display PCB interface with the microcontroller. The pins being utilized in this project are the +5V, GND, PA1, PA3, PA5, PA7, PB0 - PB3 and PAD4 - PAD6. The PA pins correspond to PORTA, PB pins correspond to PORTB, PAD pins correspond to the channel number in the ATDCTL5 register. See the Axman CML-12C32 Manual for more information. Parts List PCB layout The PCB layout was designed to fit on a relatively small sized board (3.15" X 2.5") with only one copper routing layer on the underside of the board. In the layout picture, all traces are routed on the copper bottom, with the view on top looking though the board. Below is a map of the PCB labels to components Testing the PCB circuit To thoroughly test that the PCB circuit is operating as expected, a simple counter program can be used to count up from zero to 216-1 (65535) A sample of a counter program is shown below: #include //common defines and macros #include "derivative.h" //derivative-specific definitions #define MS 1015 //# of loops for 1ms delay //Prototypes void count(unsigned int count, unsigned int delay); void sleep(unsigned int count); void main(void) { //set data direction masks DDRA |= 0b11111111; DDRB |= 0b00001111; count(65535, 5); //count up to 65535 in hexadecimal for(;;) {} //never leave main } void count(unsigned int count, unsigned int delay) { unsigned int i,j,k,n; for(i=0;i Additional Photos